package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateHomePageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateAppHomePageGetPageVO;
import com.itlong.cloud.noncore.operate.IOperateAppHomePageServiceClient;
import com.itlong.cloud.operate.service.IOperateAppHomePageService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      运营-APP-启动页管理
 * </desc>
 *
 * @createDate 2019/06/24
 */
@RestController
public class OperateAppHomePageServiceResource implements IOperateAppHomePageServiceClient {
    @Autowired
    IOperateAppHomePageService iOperateAppHomePageService;

    /**
     * <desc>
     *      获取分页数据
     * </desc>
     *
     * @return page模型
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @RequestMapping(path = "/operate/appManage/homePage/getHomePage")
    @Override
    public Page<OperateAppHomePageGetPageVO> getHomePage() throws Exception {
        return iOperateAppHomePageService.getHomePage();
    }

    /**
     * <desc>
     *      添加启动页
     * </desc>
     *
     * @param dto 功能实体
     * @return sql执行行数
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/appManage/homePage/save")
    public Integer save(@RequestBody OperateHomePageDTO dto) throws Exception {
        return iOperateAppHomePageService.save(dto);
    }

    /**
     * <desc>
     *      修改功能
     * </desc>
     *
     * @param dto 功能实体
     * @return sql执行行数
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/appManage/homePage/update")
    public Integer update(@RequestBody OperateHomePageDTO dto) throws Exception {
        return iOperateAppHomePageService.update(dto);
    }

    /**
     * <desc>
     *      查询单条功能
     * </desc>
     *
     * @param homePageId 启动页编号
     * @return 资源实体
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/appManage/homePage/getOne")
    public OperateAppHomePageGetPageVO getOne(@RequestParam("homePageId") String homePageId) {
        return iOperateAppHomePageService.getOne(homePageId);
    }

    /**
     * <desc>
     *      删除功能
     * </desc>
     *
     * @param homePageId 启动页编号
     * @return 执行行数
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/appManage/homePage/delete")
    public Integer delete(@RequestParam("homePageId") String homePageId) {
        return iOperateAppHomePageService.delete(homePageId);
    }

    /**
     * <desc>
     *      获取启动页可用数据
     * </desc>
     *
     * @return page模型
     * @author Qiang.S
     * @createDate 2019/06/24
     */
    @Override
    @RequestMapping(path = "/operate/appManage/homePage/StartAdvertising")
    public OperateAppHomePageGetPageVO StartAdvertising() {
        return iOperateAppHomePageService.StartAdvertising();
    }
}
